﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CheckList
{
    public partial class formMain : Form
    {
        public formWyroby formWyroby_ = new formWyroby();

        public formMain()
        {
            InitializeComponent();
         }



        private void WyrobyMenuItem_Click(object sender, EventArgs e)
        {
            this.openFormWyroby();
        }

        private void openFormWyroby()
        {           
            
            // open form only if is not open already
            bool isFormOpen = false;

            // iterate through all open forms
            foreach (Form frm in Application.OpenForms)
            {
                if (frm is formWyroby)
                {
                    // open already so just bring it to the front
                    frm.BringToFront();
                    isFormOpen = true;
                    break;
                }
            }
            if (!isFormOpen)
            {
                // not open so show it                
                formWyroby_.MdiParent = this;
                formWyroby_.Show();

            }
            else
            {
                formWyroby_.Dispose();
            }
        }

        private void formMain_Load(object sender, EventArgs e)
        {

        }

        private void menuGlowne_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }
    }
}
